// 接口获取 sessionkey
// export const htxcx = (code)=>uniAjax("http://192.168.0.107:81/dev-api/appletApi/system/getUnionid",{'code':code},"GET")
export const htxcx = (code)=>uniAjax("https://qhnxin.com/prod-api/appletApi/system/getUnionid",{'code':code},"GET")

// 解密手机号
// export const getPhone = (obj)=>uniAjax("http://192.168.0.107:81/dev-api/appletApi/system/getWxUserInfo",obj,"GET")
export const getPhone = (obj)=>uniAjax("https://qhnxin.com/prod-api/appletApi/system/getWxUserInfo",obj,"GET")

export function uniAjax(url,params,method){
	var method = method || "GET"
	// 处理特殊字符
	return new Promise((resolve, reject)=>{
		try{
			uni.request({
				url:url,
				dataType:"json",
				header: {
				   'Content-Type': 'application/json'  
				},  
				data:params,
				method:method,
				success:(res)=>{
					// console.log("res手机号的值"+res.data.phone)
					resolve(res)
				},
				fail:(fail)=>{
					reject(fail)
				},
				complete:(res)=>{
					// console.log("complete:",res)
				},
			})
		}catch(e){
			reject(e)
		}
		
	})
}